/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page, TreeDataModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface BasInvOuter extends BasicModel<BasInvOuter> {
  invCode?: string; // 存货编码
  invName?: string; // 存货名称
  invStd?: string; // 规格型号
  unitName?: string; // 单位
  appId?: string; // APPID
  clink?: string; // 链接地址
  picUrl?: string; // 封面图
  fbStatus?: string; // 发布状态
}

export const basInvOuterList = (params?: BasInvOuter | any) =>
  defHttp.get<BasInvOuter>({ url: adminPath + '/bas/invOuter/list', params });

export const basInvOuterListData = (params?: BasInvOuter | any) =>
  defHttp.post<Page<BasInvOuter>>({ url: adminPath + '/bas/invOuter/listData', params });

export const basInvOuterForm = (params?: BasInvOuter | any) =>
  defHttp.get<BasInvOuter>({ url: adminPath + '/bas/invOuter/form', params });

export const basInvOuterSave = (params?: any, data?: BasInvOuter | any) =>
  defHttp.postJson<BasInvOuter>({ url: adminPath + '/bas/invOuter/save', params, data });

export const basInvOuterDelete = (params?: BasInvOuter | any) =>
  defHttp.get<BasInvOuter>({ url: adminPath + '/bas/invOuter/delete', params });

export const updateFbStatus = (params?: any, data?: BasInvOuter | any) =>
  defHttp.postJson<BasInvOuter>({ url: adminPath + '/bas/invOuter/updateFbStatus', params, data });

// 存货停用
export const disableInv = (params?: any, data?: BasInvOuter | any) =>
  defHttp.postJson<BasInvOuter>({ url: adminPath + '/bas/invOuter/disableInv', params, data });

// 存货启用
export const enableInv = (params?: any, data?: BasInvOuter | any) =>
  defHttp.postJson<BasInvOuter>({ url: adminPath + '/bas/invOuter/enableInv', params, data });

export const savePic = (params?: any, data?: BasInvOuter | any) =>
  defHttp.postJson<BasInvOuter>({ url: adminPath + '/shop/shopInv/saveOuterInvPic', params, data });

export const cusInvListData = (params?: BasInvOuter | any) =>
  defHttp.post<Page<BasInvOuter>>({ url: adminPath + '/shop/shopInv/cusInvListData', params });

export const basInvTreeData2 = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/bas/inv/treeData', params });
